package StudyCode.summary.myfile;

import java.io.IOException;
import java.nio.file.FileSystem;
import java.nio.file.FileSystems;
import java.nio.file.Files;
import java.nio.file.Path;

/**
 * 版权所有 科技与人文(www.tah1986.com)
 */
public class MoveAFile {
	public static void main(String[] args) {
		FileSystem fileSystem = FileSystems.getDefault();
		Path sourcePath = fileSystem.getPath("E:\\Copy\\1\\test1.txt");
		Path targetPath = fileSystem.getPath("E:\\Copy\\2\\test1.txt");
		try {
			Files.move(sourcePath, targetPath);
			System.out.println("文件从 " + sourcePath.toAbsolutePath().toString() + " 剪贴到 " + targetPath.toAbsolutePath().toString()
					+ "成功。");
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
}
